﻿<div class="content-title">
	<h3>add user</h3>
</div>
<hr/>
<div class="web-form">		
	<?php if($_SESSION['log-err']) { ?>
		<div class="log-err">
			<?php echo $_SESSION['log-err'];?>
		</div>
	<?php }
		if($_SESSION['log-info']){ ?>
		<div class="log-info">
			<?php echo $_SESSION['log-info'];?>
		</div>	
	<?php } ?>
	<form id="addUserForm" action="./system/addUser.php" method="POST">
		<fieldset>
		<legend>user තොරතුරු</legend>
			<table class="width-100">
				<tr>
					<td>user name <span class="mandatory"> * </span></td>
					<td colspan="3"><input type="text" name="userName" class="width-200"/></td>
				</tr>
				<tr>
					<td>password <span class="mandatory"> * </span></td>
					<td colspan="3"><input type="password" name="userPassword" class="width-200"/></td>
				</tr>
				<tr>
					<td>re enter password <span class="mandatory"> * </span></td>
					<td colspan="3"><input type="password" name="rePassword" class="width-200"/></td>
				</tr>
				<tr>
					<td>user role <span class="mandatory"> * </span></td>
					<td colspan="3">
						<select id="userRoleId" name="userRoleId" class="width-200">
							<option value='0'>Select</option>
						<?php 
							require_once './system/model/dbconnection.php';
							$DB = new dbConnection();
							$userRoles = mysql_query("SELECT * FROM user_roles");
							if(mysql_num_rows($userRoles) > 0){
								while($role = mysql_fetch_assoc($userRoles)){
									echo "<option value='".$role['roleId']."'>".$role['roleName']."</option>";
								}
							}
						?>
						</select>
					</td>
				</tr>
				<tr>
					<td>full name <span class="mandatory"> * </span></td>
					<td colspan="3"><textarea id="userFullName" name="userFullName" class="width-675"></textarea></td>
				</tr>
				<tr>
					<td>address <span class="mandatory"> * </span></td>
					<td colspan="3"><textarea id="userAddress" name="userAddress" class="width-675"></textarea></td>
				</tr>
				<tr>
					<td>දුරකථන අංක</td>
					<td colspan="3">
						<table>
							<tr>
								<td>නිවස</td>
								<td><input type="text" id="userLandPhone" name="userLandPhone" class="width-200"/></td>
							</tr>
							<tr>
								<td>ජංගම</td>
								<td><input type="text" id="userMobilePhone" name="userMobilePhone" class="width-200"/></td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>ඉ-තැපැල් ලිපිනය</td>
					<td><input type="text" id="userEmail" name="userEmail" class="width-200"/></td>
					<td>ෆැක්ස් ලිපිනය</td>
					<td><input type="text" id="userFax" name="userFax" class="width-200"/></td>
				</tr>
			</table>
		</fieldset>
		<hr/>
		<div class="form-buttons">
			<button id="cancelButton" name="cancelButton" type="submit" class="web-form-button cancel">
				<img src="./public/images/cancel.png">
				<span>අවලංගු කරන්න</span>
			</button>
			<button id="resetButton" name="resetButton" type="reset" class="web-form-button cancel">
				<img src="./public/images/reset.png">
				<span>යලි පිහිටුවන්න</span>
			</button>
			<button id="addStudentButton" name="addStudentButton" type="submit" class="web-form-button">
				<img src="./public/images/add_user.png">
				<span>ඇතුලත් කරන්න</span>
			</button>
		</div>
	</form>
</div>